from common.case import read_cases, send_request, check
from common.db import DB


def signup():
    DB().init_db('signup.sql')
    cases=read_cases('signup.xlsx',['用例编号', '用例说明', '接口路径','请求方法','请求类型', '参数', '预期结果','验库sql','预期行数'])
    for case in cases:
        case_info,url,method,request_type,args,expect,check_sql,expect_rows=case
        res_type,actual=send_request(url,method,request_type,args)
        check(case_info,res_type,actual,expect)  #检查响应结果是否正确
        DB().checkdb(case_info,args,check_sql,expect_rows)
if __name__=='__main__':
    signup()